<!-- HTML header for doxygen 1.8.13-->
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.9.2"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>(abstraction-rtos)</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="navtree.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="resize.js"></script>
<script type="text/javascript" src="navtreedata.js"></script>
<script type="text/javascript" src="navtree.js"></script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<link href="doxygen_style.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  <td id="projectlogo"><a href="http://www.cypress.com/"><img alt="Logo" src="logo.png"/></a></td>
  <td id="projectalign" style="padding-left: 0.5em;">
   <div id="projectname">(abstraction-rtos)</div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.9.2 -->
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&amp;dn=expat.txt MIT */
var searchBox = new SearchBox("searchBox", "search",'Search','.html');
/* @license-end */
</script>
<script type="text/javascript" src="menudata.js"></script>
<script type="text/javascript" src="menu.js"></script>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&amp;dn=expat.txt MIT */
$(function() {
  initMenu('',true,false,'search.php','Search');
  $(document).ready(function() { init_search(); });
});
/* @license-end */
</script>
<div id="main-nav"></div>
</div><!-- top -->
<div id="side-nav" class="ui-resizable side-nav-resizable">
  <div id="nav-tree">
    <div id="nav-tree-contents">
      <div id="nav-sync" class="sync"></div>
    </div>
  </div>
  <div id="splitbar" style="-moz-user-select:none;" 
       class="ui-resizable-handle">
  </div>
</div>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&amp;dn=expat.txt MIT */
$(document).ready(function(){initNavTree('group__group__abstraction__rtos__mutex.html',''); initResizable(); });
/* @license-end */
</script>
<div id="doc-content">
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>

<div class="header">
  <div class="headertitle"><div class="title">Mutex</div></div>
</div><!--header-->
<div class="contents">
<a name="details" id="details"></a><h2 class="groupheader">General Description</h2>
<p >APIs for acquiring and working with Mutexes. </p>
<table class="memberdecls">
<tr class="memitem:ga7bfc42214af6ee47e803e761c84beed5"><td class="memItemLeft" align="right" valign="top">cy_rslt_t&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__group__abstraction__rtos__mutex.html#ga7bfc42214af6ee47e803e761c84beed5">cy_rtos_mutex_init</a> (<a class="el" href="group__group__abstraction__rtos__port.html#ga20623d7ca01f21ec5ef09879eb2eb166">cy_mutex_t</a> *mutex, bool recursive)</td></tr>
<tr class="memdesc:ga7bfc42214af6ee47e803e761c84beed5"><td class="mdescLeft">&#160;</td><td class="mdescRight">Create a mutex which can support recursion or not.  <a href="group__group__abstraction__rtos__mutex.html#ga7bfc42214af6ee47e803e761c84beed5">More...</a><br /></td></tr>
<tr class="separator:ga7bfc42214af6ee47e803e761c84beed5"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:gaa40e24bd907a739e8fe012b53120cbcd"><td class="memItemLeft" align="right" valign="top">cy_rslt_t&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__group__abstraction__rtos__mutex.html#gaa40e24bd907a739e8fe012b53120cbcd">cy_rtos_mutex_get</a> (<a class="el" href="group__group__abstraction__rtos__port.html#ga20623d7ca01f21ec5ef09879eb2eb166">cy_mutex_t</a> *mutex, <a class="el" href="group__group__abstraction__rtos__port.html#ga141349b315f2266d5e0e8b8566eb608b">cy_time_t</a> timeout_ms)</td></tr>
<tr class="memdesc:gaa40e24bd907a739e8fe012b53120cbcd"><td class="mdescLeft">&#160;</td><td class="mdescRight">Get a mutex.  <a href="group__group__abstraction__rtos__mutex.html#gaa40e24bd907a739e8fe012b53120cbcd">More...</a><br /></td></tr>
<tr class="separator:gaa40e24bd907a739e8fe012b53120cbcd"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga295b4fe6576c3f86f2569e65cd70b84f"><td class="memItemLeft" align="right" valign="top">cy_rslt_t&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__group__abstraction__rtos__mutex.html#ga295b4fe6576c3f86f2569e65cd70b84f">cy_rtos_mutex_set</a> (<a class="el" href="group__group__abstraction__rtos__port.html#ga20623d7ca01f21ec5ef09879eb2eb166">cy_mutex_t</a> *mutex)</td></tr>
<tr class="memdesc:ga295b4fe6576c3f86f2569e65cd70b84f"><td class="mdescLeft">&#160;</td><td class="mdescRight">Set a mutex.  <a href="group__group__abstraction__rtos__mutex.html#ga295b4fe6576c3f86f2569e65cd70b84f">More...</a><br /></td></tr>
<tr class="separator:ga295b4fe6576c3f86f2569e65cd70b84f"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:gac001ff85c634852dde8671c5e9f7b542"><td class="memItemLeft" align="right" valign="top">cy_rslt_t&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__group__abstraction__rtos__mutex.html#gac001ff85c634852dde8671c5e9f7b542">cy_rtos_mutex_deinit</a> (<a class="el" href="group__group__abstraction__rtos__port.html#ga20623d7ca01f21ec5ef09879eb2eb166">cy_mutex_t</a> *mutex)</td></tr>
<tr class="memdesc:gac001ff85c634852dde8671c5e9f7b542"><td class="mdescLeft">&#160;</td><td class="mdescRight">Deletes a mutex.  <a href="group__group__abstraction__rtos__mutex.html#gac001ff85c634852dde8671c5e9f7b542">More...</a><br /></td></tr>
<tr class="separator:gac001ff85c634852dde8671c5e9f7b542"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga971606a7b21c982c87a11933465110f9"><td class="memItemLeft" align="right" valign="top">#define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__group__abstraction__rtos__mutex.html#ga971606a7b21c982c87a11933465110f9">cy_rtos_init_mutex2</a>(mutex,  recursive)&#160;&#160;&#160;    <a class="el" href="group__group__abstraction__rtos__mutex.html#ga7bfc42214af6ee47e803e761c84beed5">cy_rtos_mutex_init</a>(mutex, recursive)</td></tr>
<tr class="memdesc:ga971606a7b21c982c87a11933465110f9"><td class="mdescLeft">&#160;</td><td class="mdescRight">Create a mutex which can support recursion or not.  <a href="group__group__abstraction__rtos__mutex.html#ga971606a7b21c982c87a11933465110f9">More...</a><br /></td></tr>
<tr class="separator:ga971606a7b21c982c87a11933465110f9"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga79fbca5c574d2bc617af90d4bff6c902"><td class="memItemLeft" align="right" valign="top">#define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__group__abstraction__rtos__mutex.html#ga79fbca5c574d2bc617af90d4bff6c902">cy_rtos_init_mutex</a>(mutex)&#160;&#160;&#160;    <a class="el" href="group__group__abstraction__rtos__mutex.html#ga7bfc42214af6ee47e803e761c84beed5">cy_rtos_mutex_init</a>(mutex, true)</td></tr>
<tr class="memdesc:ga79fbca5c574d2bc617af90d4bff6c902"><td class="mdescLeft">&#160;</td><td class="mdescRight">Create a mutex which can support recursion.  <a href="group__group__abstraction__rtos__mutex.html#ga79fbca5c574d2bc617af90d4bff6c902">More...</a><br /></td></tr>
<tr class="separator:ga79fbca5c574d2bc617af90d4bff6c902"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga5931cc662867a2ee281327506b4da85a"><td class="memItemLeft" align="right" valign="top">#define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__group__abstraction__rtos__mutex.html#ga5931cc662867a2ee281327506b4da85a">cy_rtos_get_mutex</a>(mutex,  timeout_ms)&#160;&#160;&#160;    <a class="el" href="group__group__abstraction__rtos__mutex.html#gaa40e24bd907a739e8fe012b53120cbcd">cy_rtos_mutex_get</a>(mutex, timeout_ms)</td></tr>
<tr class="memdesc:ga5931cc662867a2ee281327506b4da85a"><td class="mdescLeft">&#160;</td><td class="mdescRight">Get a mutex.  <a href="group__group__abstraction__rtos__mutex.html#ga5931cc662867a2ee281327506b4da85a">More...</a><br /></td></tr>
<tr class="separator:ga5931cc662867a2ee281327506b4da85a"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga4af2611cb8f459d1b3c2d872a2690bdf"><td class="memItemLeft" align="right" valign="top">#define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__group__abstraction__rtos__mutex.html#ga4af2611cb8f459d1b3c2d872a2690bdf">cy_rtos_set_mutex</a>(mutex)&#160;&#160;&#160;<a class="el" href="group__group__abstraction__rtos__mutex.html#ga295b4fe6576c3f86f2569e65cd70b84f">cy_rtos_mutex_set</a>(mutex)</td></tr>
<tr class="memdesc:ga4af2611cb8f459d1b3c2d872a2690bdf"><td class="mdescLeft">&#160;</td><td class="mdescRight">Set a mutex.  <a href="group__group__abstraction__rtos__mutex.html#ga4af2611cb8f459d1b3c2d872a2690bdf">More...</a><br /></td></tr>
<tr class="separator:ga4af2611cb8f459d1b3c2d872a2690bdf"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga0f182fcf04af391bd073a2d17c4af716"><td class="memItemLeft" align="right" valign="top">#define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__group__abstraction__rtos__mutex.html#ga0f182fcf04af391bd073a2d17c4af716">cy_rtos_deinit_mutex</a>(mutex)&#160;&#160;&#160;<a class="el" href="group__group__abstraction__rtos__mutex.html#gac001ff85c634852dde8671c5e9f7b542">cy_rtos_mutex_deinit</a>(mutex)</td></tr>
<tr class="memdesc:ga0f182fcf04af391bd073a2d17c4af716"><td class="mdescLeft">&#160;</td><td class="mdescRight">Deletes a mutex.  <a href="group__group__abstraction__rtos__mutex.html#ga0f182fcf04af391bd073a2d17c4af716">More...</a><br /></td></tr>
<tr class="separator:ga0f182fcf04af391bd073a2d17c4af716"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table>
<h2 class="groupheader">Macro Definition Documentation</h2>
<a id="ga971606a7b21c982c87a11933465110f9" name="ga971606a7b21c982c87a11933465110f9"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ga971606a7b21c982c87a11933465110f9">&#9670;&nbsp;</a></span>cy_rtos_init_mutex2</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">#define cy_rtos_init_mutex2</td>
          <td>(</td>
          <td class="paramtype">&#160;</td>
          <td class="paramname">mutex, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">&#160;</td>
          <td class="paramname">recursive&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td>&#160;&#160;&#160;    <a class="el" href="group__group__abstraction__rtos__mutex.html#ga7bfc42214af6ee47e803e761c84beed5">cy_rtos_mutex_init</a>(mutex, recursive)</td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Create a mutex which can support recursion or not. </p>
<p >Creates a binary mutex which can be used for mutual exclusion to prevent simulatenous access of shared resources. Created mutexes can support priority inheritance if recursive.</p>
<dl class="section note"><dt>Note</dt><dd>Not all RTOS implementations support non-recursive mutexes. In this case a recursive mutex will be created.</dd></dl>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramdir">[out]</td><td class="paramname">mutex</td><td>Pointer to the mutex handle to be initialized </td></tr>
    <tr><td class="paramdir">[in]</td><td class="paramname">recursive</td><td>Should the created mutex support recursion or not</td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>The status of mutex creation request. [<a class="el" href="group__group__abstraction__rtos__common.html#gaf58fac450d9fff4472f03ad68f6e546e">CY_RSLT_SUCCESS</a>, <a class="el" href="group__group__abstraction__rtos__common.html#ga516d500bef7d6e6291f08485d0bc003b">CY_RTOS_NO_MEMORY</a>, <a class="el" href="group__group__abstraction__rtos__common.html#ga89a0a071bd7a41b5d1f3edb969ee1647">CY_RTOS_GENERAL_ERROR</a>] </dd></dl>

</div>
</div>
<a id="ga79fbca5c574d2bc617af90d4bff6c902" name="ga79fbca5c574d2bc617af90d4bff6c902"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ga79fbca5c574d2bc617af90d4bff6c902">&#9670;&nbsp;</a></span>cy_rtos_init_mutex</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">#define cy_rtos_init_mutex</td>
          <td>(</td>
          <td class="paramtype">&#160;</td>
          <td class="paramname">mutex</td><td>)</td>
          <td>&#160;&#160;&#160;    <a class="el" href="group__group__abstraction__rtos__mutex.html#ga7bfc42214af6ee47e803e761c84beed5">cy_rtos_mutex_init</a>(mutex, true)</td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Create a mutex which can support recursion. </p>
<p >Creates a binary mutex which can be used for mutual exclusion to prevent simulatenous access of shared resources. Created mutexes can support priority inheritance if recursive.</p>
<dl class="section note"><dt>Note</dt><dd>Not all RTOS implementations support non-recursive mutexes. In this case a recursive mutex will be created.</dd></dl>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramdir">[out]</td><td class="paramname">mutex</td><td>Pointer to the mutex handle to be initialized</td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>The status of mutex creation request. [<a class="el" href="group__group__abstraction__rtos__common.html#gaf58fac450d9fff4472f03ad68f6e546e">CY_RSLT_SUCCESS</a>, <a class="el" href="group__group__abstraction__rtos__common.html#ga516d500bef7d6e6291f08485d0bc003b">CY_RTOS_NO_MEMORY</a>, <a class="el" href="group__group__abstraction__rtos__common.html#ga89a0a071bd7a41b5d1f3edb969ee1647">CY_RTOS_GENERAL_ERROR</a>] </dd></dl>

</div>
</div>
<a id="ga5931cc662867a2ee281327506b4da85a" name="ga5931cc662867a2ee281327506b4da85a"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ga5931cc662867a2ee281327506b4da85a">&#9670;&nbsp;</a></span>cy_rtos_get_mutex</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">#define cy_rtos_get_mutex</td>
          <td>(</td>
          <td class="paramtype">&#160;</td>
          <td class="paramname">mutex, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">&#160;</td>
          <td class="paramname">timeout_ms&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td>&#160;&#160;&#160;    <a class="el" href="group__group__abstraction__rtos__mutex.html#gaa40e24bd907a739e8fe012b53120cbcd">cy_rtos_mutex_get</a>(mutex, timeout_ms)</td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Get a mutex. </p>
<p >If the mutex is available, it is acquired and this function returned. If the mutex is not available, the thread waits until the mutex is available or until the timeout occurs.</p>
<dl class="section note"><dt>Note</dt><dd>This function must not be called from an interrupt context as it may block.</dd></dl>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramdir">[in]</td><td class="paramname">mutex</td><td>Pointer to the mutex handle </td></tr>
    <tr><td class="paramdir">[in]</td><td class="paramname">timeout_ms</td><td>Maximum number of milliseconds to wait while attempting to get the mutex. Use the <a class="el" href="group__group__abstraction__rtos__common.html#gab31d8535128df9506a4220c2b1f41a60">CY_RTOS_NEVER_TIMEOUT</a> constant to wait forever.</td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>The status of the get mutex. Returns timeout if mutex was not acquired before timeout_ms period. [<a class="el" href="group__group__abstraction__rtos__common.html#gaf58fac450d9fff4472f03ad68f6e546e">CY_RSLT_SUCCESS</a>, <a class="el" href="group__group__abstraction__rtos__common.html#gafc6a1c6f563521d6c5555027d5d7bde8">CY_RTOS_TIMEOUT</a>, <a class="el" href="group__group__abstraction__rtos__common.html#ga89a0a071bd7a41b5d1f3edb969ee1647">CY_RTOS_GENERAL_ERROR</a>] </dd></dl>

</div>
</div>
<a id="ga4af2611cb8f459d1b3c2d872a2690bdf" name="ga4af2611cb8f459d1b3c2d872a2690bdf"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ga4af2611cb8f459d1b3c2d872a2690bdf">&#9670;&nbsp;</a></span>cy_rtos_set_mutex</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">#define cy_rtos_set_mutex</td>
          <td>(</td>
          <td class="paramtype">&#160;</td>
          <td class="paramname">mutex</td><td>)</td>
          <td>&#160;&#160;&#160;<a class="el" href="group__group__abstraction__rtos__mutex.html#ga295b4fe6576c3f86f2569e65cd70b84f">cy_rtos_mutex_set</a>(mutex)</td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Set a mutex. </p>
<p >The mutex is released allowing any other threads waiting on the mutex to obtain the semaphore.</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramdir">[in]</td><td class="paramname">mutex</td><td>Pointer to the mutex handle</td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>The status of the set mutex request. [<a class="el" href="group__group__abstraction__rtos__common.html#gaf58fac450d9fff4472f03ad68f6e546e">CY_RSLT_SUCCESS</a>, <a class="el" href="group__group__abstraction__rtos__common.html#ga89a0a071bd7a41b5d1f3edb969ee1647">CY_RTOS_GENERAL_ERROR</a>] </dd></dl>

</div>
</div>
<a id="ga0f182fcf04af391bd073a2d17c4af716" name="ga0f182fcf04af391bd073a2d17c4af716"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ga0f182fcf04af391bd073a2d17c4af716">&#9670;&nbsp;</a></span>cy_rtos_deinit_mutex</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">#define cy_rtos_deinit_mutex</td>
          <td>(</td>
          <td class="paramtype">&#160;</td>
          <td class="paramname">mutex</td><td>)</td>
          <td>&#160;&#160;&#160;<a class="el" href="group__group__abstraction__rtos__mutex.html#gac001ff85c634852dde8671c5e9f7b542">cy_rtos_mutex_deinit</a>(mutex)</td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Deletes a mutex. </p>
<p >This function frees the resources associated with a sempahore.</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramdir">[in]</td><td class="paramname">mutex</td><td>Pointer to the mutex handle</td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>The status to the delete request. [<a class="el" href="group__group__abstraction__rtos__common.html#gaf58fac450d9fff4472f03ad68f6e546e">CY_RSLT_SUCCESS</a>, <a class="el" href="group__group__abstraction__rtos__common.html#ga89a0a071bd7a41b5d1f3edb969ee1647">CY_RTOS_GENERAL_ERROR</a>] </dd></dl>

</div>
</div>
<h2 class="groupheader">Function Documentation</h2>
<a id="ga7bfc42214af6ee47e803e761c84beed5" name="ga7bfc42214af6ee47e803e761c84beed5"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ga7bfc42214af6ee47e803e761c84beed5">&#9670;&nbsp;</a></span>cy_rtos_mutex_init()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">cy_rslt_t cy_rtos_mutex_init </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="group__group__abstraction__rtos__port.html#ga20623d7ca01f21ec5ef09879eb2eb166">cy_mutex_t</a> *&#160;</td>
          <td class="paramname"><em>mutex</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">bool&#160;</td>
          <td class="paramname"><em>recursive</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Create a mutex which can support recursion or not. </p>
<p >Creates a binary mutex which can be used for mutual exclusion to prevent simulatenous access of shared resources. Created mutexes can support priority inheritance if recursive.</p>
<dl class="section note"><dt>Note</dt><dd>Not all RTOS implementations support non-recursive mutexes. In this case a recursive mutex will be created.</dd></dl>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramdir">[out]</td><td class="paramname">mutex</td><td>Pointer to the mutex handle to be initialized </td></tr>
    <tr><td class="paramdir">[in]</td><td class="paramname">recursive</td><td>Should the created mutex support recursion or not</td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>The status of mutex creation request. [<a class="el" href="group__group__abstraction__rtos__common.html#gaf58fac450d9fff4472f03ad68f6e546e">CY_RSLT_SUCCESS</a>, <a class="el" href="group__group__abstraction__rtos__common.html#ga516d500bef7d6e6291f08485d0bc003b">CY_RTOS_NO_MEMORY</a>, <a class="el" href="group__group__abstraction__rtos__common.html#ga89a0a071bd7a41b5d1f3edb969ee1647">CY_RTOS_GENERAL_ERROR</a>] </dd></dl>

</div>
</div>
<a id="gaa40e24bd907a739e8fe012b53120cbcd" name="gaa40e24bd907a739e8fe012b53120cbcd"></a>
<h2 class="memtitle"><span class="permalink"><a href="#gaa40e24bd907a739e8fe012b53120cbcd">&#9670;&nbsp;</a></span>cy_rtos_mutex_get()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">cy_rslt_t cy_rtos_mutex_get </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="group__group__abstraction__rtos__port.html#ga20623d7ca01f21ec5ef09879eb2eb166">cy_mutex_t</a> *&#160;</td>
          <td class="paramname"><em>mutex</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="group__group__abstraction__rtos__port.html#ga141349b315f2266d5e0e8b8566eb608b">cy_time_t</a>&#160;</td>
          <td class="paramname"><em>timeout_ms</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Get a mutex. </p>
<p >If the mutex is available, it is acquired and this function returned. If the mutex is not available, the thread waits until the mutex is available or until the timeout occurs.</p>
<dl class="section note"><dt>Note</dt><dd>This function must not be called from an interrupt context as it may block.</dd></dl>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramdir">[in]</td><td class="paramname">mutex</td><td>Pointer to the mutex handle </td></tr>
    <tr><td class="paramdir">[in]</td><td class="paramname">timeout_ms</td><td>Maximum number of milliseconds to wait while attempting to get the mutex. Use the <a class="el" href="group__group__abstraction__rtos__common.html#gab31d8535128df9506a4220c2b1f41a60">CY_RTOS_NEVER_TIMEOUT</a> constant to wait forever.</td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>The status of the get mutex. Returns timeout if mutex was not acquired before timeout_ms period. [<a class="el" href="group__group__abstraction__rtos__common.html#gaf58fac450d9fff4472f03ad68f6e546e">CY_RSLT_SUCCESS</a>, <a class="el" href="group__group__abstraction__rtos__common.html#gafc6a1c6f563521d6c5555027d5d7bde8">CY_RTOS_TIMEOUT</a>, <a class="el" href="group__group__abstraction__rtos__common.html#ga89a0a071bd7a41b5d1f3edb969ee1647">CY_RTOS_GENERAL_ERROR</a>] </dd></dl>

</div>
</div>
<a id="ga295b4fe6576c3f86f2569e65cd70b84f" name="ga295b4fe6576c3f86f2569e65cd70b84f"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ga295b4fe6576c3f86f2569e65cd70b84f">&#9670;&nbsp;</a></span>cy_rtos_mutex_set()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">cy_rslt_t cy_rtos_mutex_set </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="group__group__abstraction__rtos__port.html#ga20623d7ca01f21ec5ef09879eb2eb166">cy_mutex_t</a> *&#160;</td>
          <td class="paramname"><em>mutex</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Set a mutex. </p>
<p >The mutex is released allowing any other threads waiting on the mutex to obtain the semaphore.</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramdir">[in]</td><td class="paramname">mutex</td><td>Pointer to the mutex handle</td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>The status of the set mutex request. [<a class="el" href="group__group__abstraction__rtos__common.html#gaf58fac450d9fff4472f03ad68f6e546e">CY_RSLT_SUCCESS</a>, <a class="el" href="group__group__abstraction__rtos__common.html#ga89a0a071bd7a41b5d1f3edb969ee1647">CY_RTOS_GENERAL_ERROR</a>] </dd></dl>

</div>
</div>
<a id="gac001ff85c634852dde8671c5e9f7b542" name="gac001ff85c634852dde8671c5e9f7b542"></a>
<h2 class="memtitle"><span class="permalink"><a href="#gac001ff85c634852dde8671c5e9f7b542">&#9670;&nbsp;</a></span>cy_rtos_mutex_deinit()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">cy_rslt_t cy_rtos_mutex_deinit </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="group__group__abstraction__rtos__port.html#ga20623d7ca01f21ec5ef09879eb2eb166">cy_mutex_t</a> *&#160;</td>
          <td class="paramname"><em>mutex</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Deletes a mutex. </p>
<p >This function frees the resources associated with a sempahore.</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramdir">[in]</td><td class="paramname">mutex</td><td>Pointer to the mutex handle</td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>The status to the delete request. [<a class="el" href="group__group__abstraction__rtos__common.html#gaf58fac450d9fff4472f03ad68f6e546e">CY_RSLT_SUCCESS</a>, <a class="el" href="group__group__abstraction__rtos__common.html#ga89a0a071bd7a41b5d1f3edb969ee1647">CY_RTOS_GENERAL_ERROR</a>] </dd></dl>

</div>
</div>
</div><!-- contents -->
</div><!-- doc-content -->
<!-- start footer part
<div id="nav-path" class="navpath">
    <ul>
        <li class="footer">
            Generated for <b>(abstraction-rtos)</b> by <b>Cypress Semiconductor Corporation</b>.
            All rights reserved.
        </li>
    </ul>
</div>
-->
</body>
</html>
